<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of IEnumerable (Of SurvivorPool.PickObj))" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Survivor Pool - My Picks Page
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h4>Picks will be locked at 5pm on Thu 04/05 for Rd 5 and 8pm on Sat 04/07 for Rd 6.</h4>
    
    <h2>
        View All Your Picks</h2>
    <table class="data-table">
        <tr>
            <th scope="col">
                Round
            </th>
            <th scope="col">
                Team
            </th>
            <th scope="col">
                Region
            </th>
            <th scope="col">
                Seed
            </th>
            <th scope="col">
                Result
            </th>
        </tr>
        <% 
            For Each item In Model
                Response.Write("<tr>")
                Response.Write("<td>" & Html.Encode(item.BracketRound) & "</td>")
                Response.Write("<td>" & Html.Encode(item.TeamDisplay) & "</td>")
                
                Response.Write("<td>")
                If item.Team IsNot Nothing Then Response.Write(Html.Encode(item.Team.Region))
                Response.Write("</td>")
                
                Response.Write("<td>")
                If item.Team IsNot Nothing Then Response.Write(Html.Encode(item.Team.Seed))
                Response.Write("</td>")

                Dim winDisplay = "<b><font color=""green"">WON</font></b>"
                Dim lossDisplay = "<font color=""red"">Loss</font>"
                
                Select Case item.BracketRound
                    Case 1
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round1Result IsNot Nothing Then
                            If item.Team.Round1Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                    Case 2
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round2Result IsNot Nothing Then
                            If item.Team.Round2Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                    Case 3
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round3Result IsNot Nothing Then
                            If item.Team.Round3Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                    Case 4
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round4Result IsNot Nothing Then
                            If item.Team.Round4Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                    Case 5
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round5Result IsNot Nothing Then
                            If item.Team.Round5Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                    Case 6
                        Response.Write("<td>")
                        If item.Team IsNot Nothing AndAlso item.Team.Round6Result IsNot Nothing Then
                            If item.Team.Round6Result Then Response.Write(winDisplay) Else Response.Write(lossDisplay)
                        End If
                        Response.Write("</td>")
                End Select
                Response.Write("</tr>")
            Next
        %>
    </table>
    <br />
    <h3><%=Html.ActionLink("Make/Edit Pick for Round 5", "5", "Picks/Edit")%></h3>
    <h3><%=Html.ActionLink("Make/Edit Pick for Round 6", "6", "Picks/Edit")%></h3>
    <br />
</asp:Content>
